

package Test;

import Control.Controller;
import Game.Match;
import Game.Tank;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;

/**
 * A main testing class. Will open up two windows that the user interacts with
 * Compiler: jdk1.6.0_14 <br />
 * IDE: NetBeans 6.7.1 <br />
 * @author Andrew Smith <br />
 */
public class Main
{
    //

    public static void main(String[] args)
    {
        System.out.println("Main Started");
        Match match = new Match();
        System.out.println("Match Started");
        Controller p1 = new Controller("Andrew", match);
        Controller p2 = new Controller("Paul", match);

        startPlayer1(p1);
        startPlayer2(p2);
    }


    public static void startPlayer1(Controller control)
    {
        System.out.println("P1 start");
        JFrame frame = new JFrame("Player 1");
        Controller test = control;
        System.out.println("P1 init");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(test);
        frame.pack();

        //sets to middle of screen and displays it
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension screenDimension = tk.getScreenSize();
        Dimension frameDimension = frame.getSize();
        frame.setLocation((screenDimension.width-frameDimension.width)/2,(screenDimension.height-frameDimension.height)/2);
        frame.setVisible(true);
        System.out.println("P1 Started");
    }


    public static void startPlayer2(Controller control)
    {
        JFrame frame = new JFrame("Player 2");
        Controller test = control;
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(test);
        frame.pack();

        //sets to middle of screen and displays it
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension screenDimension = tk.getScreenSize();
        Dimension frameDimension = frame.getSize();
        frame.setLocation((screenDimension.width-frameDimension.width)/2,(screenDimension.height-frameDimension.height)/2);
        frame.setVisible(true);
        System.out.println("P2 Started");
    }
}
